package com.yupi.springbootinit.model.enums;

/**
 * 版次步骤状态（与 process_batch_step.status 对齐）
 */
public enum StepStatus {
    PLANNED("PLANNED", "已计划"),
    READY("READY", "就绪"),
    IN_PROGRESS("IN_PROGRESS", "进行中"),
    PENDING_QA("PENDING_QA", "待检"),
    COMPLETED("COMPLETED", "已完成");

    private final String code;
    private final String displayName;

    StepStatus(String code, String displayName) {
        this.code = code;
        this.displayName = displayName;
    }

    public String code() {
        return code;
    }

    public String displayName() {
        return displayName;
    }

    public static StepStatus from(String value) {
        if (value == null) return null;
        for (StepStatus s : values()) {
            if (s.code.equalsIgnoreCase(value)) {
                return s;
            }
        }
        return null;
    }
}